# -*- codeing = utf-8 -*-
# @Time : 2021/2/26 19:06
# @Atuthor: 朱朱
# @File: 119类方法和静态方法的回顾.py
# @Software: PyCharm

class Person(object):
    type = 'human'

    def __init__(self, name, age):
        self.name = name
        self.age = age

    def demo(self):
        print('name is',self.name)

    @classmethod
    def bar(cls):
        print('类的属性是:',cls.type)

    @staticmethod
    def foo():
        print('hello staticmethod')

p = Person('jack',18)
p.demo() # 实例对象调用,会自动传参

Person.demo(p) # 这里是类对象调用,需要手动传参

p.bar()
Person.bar()

p.foo()
Person.foo()